package com.spring.sunflower.conversation;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.spring.sunflower.R;
import com.spring.sunflower.bottompanel.EmotionUtils;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * Created by Kevin on 2021/6/14<br/>
 * <p>
 * Describe:<br/>
 */
public class EmotionAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    private int emotionType;

    public EmotionAdapter(int layoutResId, @Nullable List<String> data, int emotionType) {
        super(layoutResId, data);
        this.emotionType = emotionType;
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, String s) {
        Glide.with(getContext())
                .load(EmotionUtils.getImgByName(emotionType, s))
                .into((ImageView) baseViewHolder.getView(R.id.ivEmotion));
    }
}
